#include "fyp/Gui.h"

//------------------------------------------------------------------------------
// additional header includes
#include "fyp/GuiManager.h"

#include "DXUT.h"
#include "DXUTgui.h"

//------------------------------------------------------------------------------
namespace ming
{
namespace fyp
{
	//--------------------------------------------------------------------------
	TGui::TGui(TGuiManager *guiMgr, const TStr &dlgName)
		: mGuiMgr(guiMgr), mDlgName(dlgName)
	{
		mGuiMgr->Add(mDlgName);
		mDlg = mGuiMgr->Get(mDlgName);
		mDlg->SetCallback(EventCallback, this);
	}
	
	//--------------------------------------------------------------------------
	TGui::~TGui()
	{
		mGuiMgr->Remove(mDlgName);
	}

	//--------------------------------------------------------------------------
	void __stdcall TGui::EventCallback(
		unsigned int nEvent,
		int nControlID,
		CDXUTControl* pControl,
		void* pUserContext)
	{
		static_cast<TGui*>(pUserContext)->OnControlEvent(nControlID, pControl);
	}

	//--------------------------------------------------------------------------
}
}
